3.1193 \(\int (a+b \tan (e+f x)) (c+d \tan (e+f x)) \, dx\)

Optimal. Leaf size=42 \[ -\frac{(a d+b c) \log (\cos (e+f x))}{f}+x (a c-b d)+\frac{b d \tan (e+f x)}{f} \]

[Out]

(a*c - b*d)*x - ((b*c + a*d)*Log[Cos[e + f*x]])/f + (b*d*Tan[e + f*x])/f

________________________________________________________________________________________

Rubi [A]  time = 0.0253722, antiderivative size = 42, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.095, Rules used = {3525, 3475} \[ -\frac{(a d+b c) \log (\cos (e+f x))}{f}+x (a c-b d)+\frac{b d \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x]),x]

[Out]

(a*c - b*d)*x - ((b*c + a*d)*Log[Cos[e + f*x]])/f + (b*d*Tan[e + f*x])/f

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+b \tan (e+f x)) (c+d \tan (e+f x)) \, dx &=(a c-b d) x+\frac{b d \tan (e+f x)}{f}+(b c+a d) \int \tan (e+f x) \, dx\\ &=(a c-b d) x-\frac{(b c+a d) \log (\cos (e+f x))}{f}+\frac{b d \tan (e+f x)}{f}\\ \end{align*}

Mathematica [A]  time = 0.0326185, size = 59, normalized size = 1.4 \[ a c x-\frac{a d \log (\cos (e+f x))}{f}-\frac{b c \log (\cos (e+f x))}{f}-\frac{b d \tan ^{-1}(\tan (e+f x))}{f}+\frac{b d \tan (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x]),x]

[Out]

a*c*x - (b*d*ArcTan[Tan[e + f*x]])/f - (b*c*Log[Cos[e + f*x]])/f - (a*d*Log[Cos[e + f*x]])/f + (b*d*Tan[e + f*
x])/f

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 77, normalized size = 1.8 \begin{align*}{\frac{\tan \left ( fx+e \right ) bd}{f}}+{\frac{a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) d}{2\,f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) bc}{2\,f}}+{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f}}-{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) bd}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))*(c+d*tan(f*x+e)),x)

[Out]

b*d*tan(f*x+e)/f+1/2/f*a*ln(1+tan(f*x+e)^2)*d+1/2/f*ln(1+tan(f*x+e)^2)*b*c+1/f*a*arctan(tan(f*x+e))*c-1/f*arct
an(tan(f*x+e))*b*d

________________________________________________________________________________________

Maxima [A]  time = 1.57196, size = 68, normalized size = 1.62 \begin{align*} \frac{2 \, b d \tan \left (f x + e\right ) + 2 \,{\left (a c - b d\right )}{\left (f x + e\right )} +{\left (b c + a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*b*d*tan(f*x + e) + 2*(a*c - b*d)*(f*x + e) + (b*c + a*d)*log(tan(f*x + e)^2 + 1))/f

________________________________________________________________________________________

Fricas [A]  time = 1.50945, size = 122, normalized size = 2.9 \begin{align*} \frac{2 \,{\left (a c - b d\right )} f x + 2 \, b d \tan \left (f x + e\right ) -{\left (b c + a d\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*(2*(a*c - b*d)*f*x + 2*b*d*tan(f*x + e) - (b*c + a*d)*log(1/(tan(f*x + e)^2 + 1)))/f

________________________________________________________________________________________

Sympy [A]  time = 0.222615, size = 73, normalized size = 1.74 \begin{align*} \begin{cases} a c x + \frac{a d \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{b c \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - b d x + \frac{b d \tan{\left (e + f x \right )}}{f} & \text{for}\: f \neq 0 \\x \left (a + b \tan{\left (e \right )}\right ) \left (c + d \tan{\left (e \right )}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e)),x)

[Out]

Piecewise((a*c*x + a*d*log(tan(e + f*x)**2 + 1)/(2*f) + b*c*log(tan(e + f*x)**2 + 1)/(2*f) - b*d*x + b*d*tan(e
 + f*x)/f, Ne(f, 0)), (x*(a + b*tan(e))*(c + d*tan(e)), True))

________________________________________________________________________________________

Giac [B]  time = 1.37717, size = 479, normalized size = 11.4 \begin{align*} \frac{2 \, a c f x \tan \left (f x\right ) \tan \left (e\right ) - 2 \, b d f x \tan \left (f x\right ) \tan \left (e\right ) - b c \log \left (\frac{4 \,{\left (\tan \left (e\right )^{2} + 1\right )}}{\tan \left (f x\right )^{4} \tan \left (e\right )^{2} - 2 \, \tan \left (f x\right )^{3} \tan \left (e\right ) + \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + \tan \left (f x\right )^{2} - 2 \, \tan \left (f x\right ) \tan \left (e\right ) + 1}\right ) \tan \left (f x\right ) \tan \left (e\right ) - a d \log \left (\frac{4 \,{\left (\tan \left (e\right )^{2} + 1\right )}}{\tan \left (f x\right )^{4} \tan \left (e\right )^{2} - 2 \, \tan \left (f x\right )^{3} \tan \left (e\right ) + \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + \tan \left (f x\right )^{2} - 2 \, \tan \left (f x\right ) \tan \left (e\right ) + 1}\right ) \tan \left (f x\right ) \tan \left (e\right ) - 2 \, a c f x + 2 \, b d f x + b c \log \left (\frac{4 \,{\left (\tan \left (e\right )^{2} + 1\right )}}{\tan \left (f x\right )^{4} \tan \left (e\right )^{2} - 2 \, \tan \left (f x\right )^{3} \tan \left (e\right ) + \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + \tan \left (f x\right )^{2} - 2 \, \tan \left (f x\right ) \tan \left (e\right ) + 1}\right ) + a d \log \left (\frac{4 \,{\left (\tan \left (e\right )^{2} + 1\right )}}{\tan \left (f x\right )^{4} \tan \left (e\right )^{2} - 2 \, \tan \left (f x\right )^{3} \tan \left (e\right ) + \tan \left (f x\right )^{2} \tan \left (e\right )^{2} + \tan \left (f x\right )^{2} - 2 \, \tan \left (f x\right ) \tan \left (e\right ) + 1}\right ) - 2 \, b d \tan \left (f x\right ) - 2 \, b d \tan \left (e\right )}{2 \,{\left (f \tan \left (f x\right ) \tan \left (e\right ) - f\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*a*c*f*x*tan(f*x)*tan(e) - 2*b*d*f*x*tan(f*x)*tan(e) - b*c*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2
*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) - a*d*log(4*(t
an(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e)
 + 1))*tan(f*x)*tan(e) - 2*a*c*f*x + 2*b*d*f*x + b*c*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*
tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) + a*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan
(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) - 2*b*d*tan(f*x) - 2*
b*d*tan(e))/(f*tan(f*x)*tan(e) - f)